// Copyright Epic Games, Inc. All Rights Reserved. // 版权声明，版权所有归 Epic Games, Inc.

#pragma once // 头文件保护符，确保头文件只被编译一次

#include "Engine/DataAsset.h" // 包含引擎的数据资产基类
#include "GameplayTagContainer.h" // 包含GameplayTag容器类

#include "LyraAbilityTagRelationshipMapping.generated.h" // 包含由 Unreal Header Tool 生成的代码

class UObject; // 前向声明 UObject 类

/** Struct that defines the relationship between different ability tags */ // 定义不同技能标签之间关系的结构体
USTRUCT() // 声明为 USTRUCT，供反射系统使用
struct FLyraAbilityTagRelationship
{
	GENERATED_BODY() // 宏，生成结构体反射所需的代码体

	/** The tag that this container relationship is about. Single tag, but abilities can have multiple of these */ // 此容器关系所关于的标签。单个标签，但技能可以拥有多个此类标签
	UPROPERTY(EditAnywhere, Category = Ability, meta = (Categories = "Gameplay.Action")) // 可编辑属性，分类为 Ability，元数据指定标签选择器限定在 "Gameplay.Action" 分类下
	FGameplayTag AbilityTag; // 技能标签

	/** The other ability tags that will be blocked by any ability using this tag */ // 任何使用此标签的技能将会阻塞的其他技能标签
	UPROPERTY(EditAnywhere, Category = Ability) // 可编辑属性，分类为 Ability
	FGameplayTagContainer AbilityTagsToBlock; // 要阻塞的技能标签容器

	/** The other ability tags that will be canceled by any ability using this tag */ // 任何使用此标签的技能将会取消的其他技能标签
	UPROPERTY(EditAnywhere, Category = Ability) // 可编辑属性，分类为 Ability
	FGameplayTagContainer AbilityTagsToCancel; // 要取消的技能标签容器

	/** If an ability has the tag, this is implicitly added to the activation required tags of the ability */ // 如果一个技能拥有此标签，这会隐式地添加到该技能的激活所需标签中
	UPROPERTY(EditAnywhere, Category = Ability) // 可编辑属性，分类为 Ability
	FGameplayTagContainer ActivationRequiredTags; // 激活所需标签容器

	/** If an ability has the tag, this is implicitly added to the activation blocked tags of the ability */ // 如果一个技能拥有此标签，这会隐式地添加到该技能的激活阻塞标签中
	UPROPERTY(EditAnywhere, Category = Ability) // 可编辑属性，分类为 Ability
	FGameplayTagContainer ActivationBlockedTags; // 激活阻塞标签容器
};


/** Mapping of how ability tags block or cancel other abilities */ // 技能标签如何阻塞或取消其他技能的映射
UCLASS() // 声明为 UCLASS，供反射系统使用
class ULyraAbilityTagRelationshipMapping : public UDataAsset // 类继承自 UDataAsset
{
	GENERATED_BODY() // 宏，生成类反射所需的代码体

private:
	/** The list of relationships between different gameplay tags (which ones block or cancel others) */ // 不同Gameplay标签之间的关系列表（哪些标签阻塞或取消其他标签）
	UPROPERTY(EditAnywhere, Category = Ability, meta=(TitleProperty="AbilityTag")) // 可编辑属性，分类为 Ability，元数据指定在编辑器列表中显示 "AbilityTag" 属性作为标题
	TArray<FLyraAbilityTagRelationship> AbilityTagRelationships; // 技能标签关系结构的数组

public:
	/** Given a set of ability tags, parse the tag relationship and fill out tags to block and cancel */ // 给定一组技能标签，解析标签关系并填充要阻塞和取消的标签
	void GetAbilityTagsToBlockAndCancel(const FGameplayTagContainer& AbilityTags, FGameplayTagContainer* OutTagsToBlock, FGameplayTagContainer* OutTagsToCancel) const; // 函数声明：获取要阻塞和取消的标签

	/** Given a set of ability tags, add additional required and blocking tags */ // 给定一组技能标签，添加额外的必需和阻塞标签
	void GetRequiredAndBlockedActivationTags(const FGameplayTagContainer& AbilityTags, FGameplayTagContainer* OutActivationRequired, FGameplayTagContainer* OutActivationBlocked) const; // 函数声明：获取激活所需和激活阻塞的标签

	/** Returns true if the specified ability tags are canceled by the passed in action tag */ // 如果指定的技能标签被传入的动作标签取消，则返回 true
	bool IsAbilityCancelledByTag(const FGameplayTagContainer& AbilityTags, const FGameplayTag& ActionTag) const; // 函数声明：判断技能是否被指定标签取消
};